package org.example.threadlocaltest.demos.configure;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Configuration  //配置类--线程池的配置文件
public class ThreadPoolConfigure {

    @Bean
    public ThreadPoolExecutor threadPoolExecutor() {
        //核心线程数10，最大线程数20，空闲时间10秒，队列大小100
        return new ThreadPoolExecutor(10, 20,
                10, TimeUnit.SECONDS, new LinkedBlockingQueue<>(100));
    }

}
